import request from '@/utils/request'
// 获取频道列表
export const channels = () => {
  return request({
    url: '/v1_0/channels'
  })
}

// 获取文章列表
export const getArticles = (params) => {
  return request({
    url: '/v1_0/mp/articles',
    params
  })
}

// 删除文章
export const delArticles = (id, draft) => {
  return request({
    url: `/v1_0/mp/articles/${id}`,
    method: 'delete',
    params: { draft }
  })
}

// 发表文章
export const addArticles = (data, boo) => {
  return request({
    url: `/v1_0/mp/articles?draft=${boo}`,
    method: 'post',
    data: data
  })
}

// 获取文章详情
export const getArticleDetail = (id) => {
  return request({
    url: `/v1_0/mp/articles/${id}`
  })
}

// 编辑文章
export const editArticles = (data, boo, id) => {
  return request({
    url: `/v1_0/mp/articles/${id}?draft=${boo}`,
    method: 'put',
    data: data
  })
}
